//
// Created by hay boy on 2022/6/26.
//

#ifndef ALGORITHMS_STACK_H
#define ALGORITHMS_STACK_H
#include <iostream>
using namespace std;

template<class T>
class Stack {
public:
    virtual ~Stack()= default;
    virtual bool empty() const = 0;
    virtual int size() const = 0;
    virtual T& top() = 0;
    virtual void pop() = 0;
    virtual void push(const T& theElement) = 0;
    virtual void clear() = 0;
};


class StackEmpty:public exception{
public:
    string error_mes;
    explicit StackEmpty(){
        error_mes="stack empty error";
    }
    const char * what() const noexcept override{
        return error_mes.c_str();
    }
};

#endif //ALGORITHMS_STACK_H
